package org.aokey.spring.ioc;

import org.aokey.spring.ioc.component.UserComponent;
import org.aokey.spring.ioc.config.UserConfiguration;
import org.aokey.spring.ioc.controller.HController;
import org.aokey.spring.ioc.controller.HelloController;
import org.aokey.spring.ioc.creat2car.Tire;
import org.aokey.spring.ioc.repository.UserRepository;
import org.aokey.spring.ioc.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class SpringIocDemoApplication {

    public static void main(String[] args) {
//        ApplicationContext context = SpringApplication.run(SpringIocDemoApplication.class, args);
//        HelloController bean=context.getBean(HelloController.class);
//        bean.print();
//        HelloController helloController=new HelloController();
//        HelloController bean0=(HelloController) context.getBean("helloController");
//        bean0.print();
//        HController bean4=(HController) context.getBean("aaaa");
//        bean4.print();
//        UserService bean6=context.getBean(UserService.class);
//        bean6.print();
//        UserRepository bean1=context.getBean(UserRepository.class);
//        bean1.print();
//        UserComponent bean2=context.getBean(UserComponent.class);
//        bean2.print();
//        UserConfiguration bean3=context.getBean(UserConfiguration.class);
//        bean3.print();
//        bean3.print2();
        ApplicationContext context=SpringApplication.run(SpringIocDemoApplication.class, args);
        Tire tire=(Tire) context.getBean("t3");
        System.out.println(tire.toString());
        Tire tire1=(Tire) context.getBean("t1");
        System.out.println(tire1.toString());
        Tire tire4=(Tire) context.getBean("t4");
        System.out.println(tire4.toString());
    }

}
